<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>lwIP: src/core/timeouts.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">lwIP
   &#160;<span id="projectnumber">2.1.2</span>
   </div>
   <div id="projectbrief">Lightweight IP stack</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('timeouts_8c.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">timeouts.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="opt_8h.html">lwip/opt.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="timeouts_8h.html">lwip/timeouts.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="tcp__priv_8h.html">lwip/priv/tcp_priv.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="def_8h.html">lwip/def.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="memp_8h.html">lwip/memp.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="tcpip__priv_8h.html">lwip/priv/tcpip_priv.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="ip4__frag_8h.html">lwip/ip4_frag.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="lwip_2etharp_8h.html">lwip/etharp.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="dhcp_8h.html">lwip/dhcp.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="autoip_8h.html">lwip/autoip.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="igmp_8h.html">lwip/igmp.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="dns_8h.html">lwip/dns.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="nd6_8h.html">lwip/nd6.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="ip6__frag_8h.html">lwip/ip6_frag.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="mld6_8h.html">lwip/mld6.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="dhcp6_8h.html">lwip/dhcp6.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="sys_8h.html">lwip/sys.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="pbuf_8h.html">lwip/pbuf.h</a>&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a8181bc316fdf61b85f787c5cadfcd249"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timeouts_8c.html#a8181bc316fdf61b85f787c5cadfcd249">tcp_timer_needed</a> (void)</td></tr>
<tr class="separator:a8181bc316fdf61b85f787c5cadfcd249"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a60f42f167f496f6f740c8df48f4dd26c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timeouts_8c.html#a60f42f167f496f6f740c8df48f4dd26c">sys_timeouts_init</a> (void)</td></tr>
<tr class="separator:a60f42f167f496f6f740c8df48f4dd26c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8deed391626ec8b5423998e33782d7a8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timeouts_8c.html#a8deed391626ec8b5423998e33782d7a8">sys_timeout</a> (u32_t msecs, <a class="el" href="timeouts_8h.html#a2ab5bb8173f492563f70a519011b0ac1">sys_timeout_handler</a> handler, void *arg)</td></tr>
<tr class="separator:a8deed391626ec8b5423998e33782d7a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adbfcaa78f4b8d71ae0d7f0bcab6f8fb6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timeouts_8c.html#adbfcaa78f4b8d71ae0d7f0bcab6f8fb6">sys_untimeout</a> (<a class="el" href="timeouts_8h.html#a2ab5bb8173f492563f70a519011b0ac1">sys_timeout_handler</a> handler, void *arg)</td></tr>
<tr class="separator:adbfcaa78f4b8d71ae0d7f0bcab6f8fb6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga83cffdf69ab60fd0eba9d17d363f9883"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lwip__nosys.html#ga83cffdf69ab60fd0eba9d17d363f9883">sys_check_timeouts</a> (void)</td></tr>
<tr class="separator:ga83cffdf69ab60fd0eba9d17d363f9883"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6913959cf264dbe876b7e7c4db1cc13e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timeouts_8c.html#a6913959cf264dbe876b7e7c4db1cc13e">sys_restart_timeouts</a> (void)</td></tr>
<tr class="separator:a6913959cf264dbe876b7e7c4db1cc13e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa9971a14a5810cfeb1efd7104cde6664"><td class="memItemLeft" align="right" valign="top">u32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timeouts_8c.html#aa9971a14a5810cfeb1efd7104cde6664">sys_timeouts_sleeptime</a> (void)</td></tr>
<tr class="separator:aa9971a14a5810cfeb1efd7104cde6664"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:addc06ab816f051a0fe6f280972eed142"><td class="memItemLeft" align="right" valign="top">const struct <a class="el" href="structlwip__cyclic__timer.html">lwip_cyclic_timer</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timeouts_8c.html#addc06ab816f051a0fe6f280972eed142">lwip_cyclic_timers</a> []</td></tr>
<tr class="separator:addc06ab816f051a0fe6f280972eed142"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9d01f287a19f20b073d3a1c306ecbfcd"><td class="memItemLeft" align="right" valign="top">const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timeouts_8c.html#a9d01f287a19f20b073d3a1c306ecbfcd">lwip_num_cyclic_timers</a> = (sizeof( <a class="el" href="timeouts_8h.html#addc06ab816f051a0fe6f280972eed142">lwip_cyclic_timers</a> )/sizeof(( <a class="el" href="timeouts_8h.html#addc06ab816f051a0fe6f280972eed142">lwip_cyclic_timers</a> )[0]))</td></tr>
<tr class="separator:a9d01f287a19f20b073d3a1c306ecbfcd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Stack-internal timers implementation. This file includes timer callbacks for stack-internal timers as well as functions to set up or stop timers and check for expired timers. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a6913959cf264dbe876b7e7c4db1cc13e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6913959cf264dbe876b7e7c4db1cc13e">&#9670;&nbsp;</a></span>sys_restart_timeouts()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sys_restart_timeouts </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Rebase the timeout times to the current time. This is necessary if <a class="el" href="group__lwip__nosys.html#ga83cffdf69ab60fd0eba9d17d363f9883">sys_check_timeouts()</a> hasn't been called for a long time (e.g. while saving energy) to prevent all timer functions of that period being called. </p>

</div>
</div>
<a id="a8deed391626ec8b5423998e33782d7a8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8deed391626ec8b5423998e33782d7a8">&#9670;&nbsp;</a></span>sys_timeout()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sys_timeout </td>
          <td>(</td>
          <td class="paramtype">u32_t&#160;</td>
          <td class="paramname"><em>msecs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="timeouts_8h.html#a2ab5bb8173f492563f70a519011b0ac1">sys_timeout_handler</a>&#160;</td>
          <td class="paramname"><em>handler</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>arg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Create a one-shot timer (aka timeout). Timeouts are processed in the following cases:</p><ul>
<li>while waiting for a message using sys_timeouts_mbox_fetch()</li>
<li>by calling <a class="el" href="group__lwip__nosys.html#ga83cffdf69ab60fd0eba9d17d363f9883">sys_check_timeouts()</a> (NO_SYS==1 only)</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">msecs</td><td>time in milliseconds after that the timer should expire </td></tr>
    <tr><td class="paramname">handler</td><td>callback function to call when msecs have elapsed </td></tr>
    <tr><td class="paramname">arg</td><td>argument to pass to the callback function </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a60f42f167f496f6f740c8df48f4dd26c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a60f42f167f496f6f740c8df48f4dd26c">&#9670;&nbsp;</a></span>sys_timeouts_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sys_timeouts_init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Initialize this module </p>

</div>
</div>
<a id="aa9971a14a5810cfeb1efd7104cde6664"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa9971a14a5810cfeb1efd7104cde6664">&#9670;&nbsp;</a></span>sys_timeouts_sleeptime()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32_t sys_timeouts_sleeptime </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Return the time left before the next timeout is due. If no timeouts are enqueued, returns 0xffffffff </p>

</div>
</div>
<a id="adbfcaa78f4b8d71ae0d7f0bcab6f8fb6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adbfcaa78f4b8d71ae0d7f0bcab6f8fb6">&#9670;&nbsp;</a></span>sys_untimeout()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sys_untimeout </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="timeouts_8h.html#a2ab5bb8173f492563f70a519011b0ac1">sys_timeout_handler</a>&#160;</td>
          <td class="paramname"><em>handler</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>arg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Go through timeout list (for this task only) and remove the first matching entry (subsequent entries remain untouched), even though the timeout has not triggered yet.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">handler</td><td>callback function that would be called by the timeout </td></tr>
    <tr><td class="paramname">arg</td><td>callback argument that would be passed to handler </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a8181bc316fdf61b85f787c5cadfcd249"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8181bc316fdf61b85f787c5cadfcd249">&#9670;&nbsp;</a></span>tcp_timer_needed()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void tcp_timer_needed </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Called from TCP_REG when registering a new PCB: the reason is to have the TCP timer only running when there are active (or time-wait) PCBs. </p>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="addc06ab816f051a0fe6f280972eed142"></a>
<h2 class="memtitle"><span class="permalink"><a href="#addc06ab816f051a0fe6f280972eed142">&#9670;&nbsp;</a></span>lwip_cyclic_timers</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const struct <a class="el" href="structlwip__cyclic__timer.html">lwip_cyclic_timer</a> lwip_cyclic_timers[]</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This array contains all stack-internal cyclic timers. To get the number of timers, use LWIP_ARRAYSIZE() </p>

</div>
</div>
<a id="a9d01f287a19f20b073d3a1c306ecbfcd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9d01f287a19f20b073d3a1c306ecbfcd">&#9670;&nbsp;</a></span>lwip_num_cyclic_timers</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const int lwip_num_cyclic_timers = (sizeof( <a class="el" href="timeouts_8h.html#addc06ab816f051a0fe6f280972eed142">lwip_cyclic_timers</a> )/sizeof(( <a class="el" href="timeouts_8h.html#addc06ab816f051a0fe6f280972eed142">lwip_cyclic_timers</a> )[0]))</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Array size of lwip_cyclic_timers[] </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_aebb8dcc11953d78e620bbef0b9e2183.html">core</a></li><li class="navelem"><a class="el" href="timeouts_8c.html">timeouts.c</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
